package com.example.websocket;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * Project:spring-boot-websoket
 * <p>
 * Title:MvcConfig.java
 * <p>
 * Description:
 * <p>
 * Copyrigth:Jiang Software LTD.co Copyright (c) 2021
 * <p>
 * 
 * @version 1.0
 * @since 1.8
 * @author jiang
 * @history 2021 jiang create
 */
@Configuration
public class MvcConfig extends WebMvcConfigurationSupport {
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		// 这里之所以多了一"/",是为了解决打jar时访问不到问题
		// 指定静态资源路径，classpath:/templates/index.html", "classpath:/index.html 指定一个即可
		registry.addResourceHandler("/index.html").addResourceLocations("classpath:/templates/index.html", "classpath:/index.html");
	}
}